
<template>
    <el-card>
      <div class="title-flex">
        <div>专家评审列表</div>
      </div>
    </el-card>
    <el-card style="margin-top: 10px">
      <el-table
          :data="tableData"
          style="width: 100%"
          ref="tableRef"
      >
        <el-table-column prop="bookName" label="项目名称"></el-table-column>
        <el-table-column prop="typeName" label="项目分类"></el-table-column>
        <el-table-column prop="endDate" label="计划结束日期">
          <template #default="{ row }">
            {{ new Date(row.endDate).toLocaleDateString() }}
          </template>
        </el-table-column>
        <el-table-column prop="applyFee" label="申请经费（万元）"></el-table-column>
        <el-table-column prop="reviewStatus" label="评审状态">
          <template #default="{ row }">
            {{ getReviewStatusText(row.reviewStatus) }}
          </template>
        </el-table-column>
        <el-table-column prop="reviewMark" label="评审分值"></el-table-column>
        <el-table-column label="操作" width="120">
          <template #default="scope">
            <el-button type="primary" size="small" plain @click="openspecialistDetails(scope.row)">查看评审</el-button>
          </template>
        </el-table-column>
      </el-table>
      <div class="example-pagination-block">
        <el-pagination
            layout="->,prev, pager, next, total"
            :total="count"
            currentPage1="10"
            @current-change="handleCurrentChange"
        />
      </div>
    </el-card>
  <historyspecialistDetails ref="specialistDetailsRef"></historyspecialistDetails>
</template>
<script setup>
import {onMounted, ref} from 'vue';
import {myreview} from './../../api/specialist/specialistApi.js'
import historyspecialistDetails from './historyspecialistDetails.vue'
const specialistDetailsRef = ref(null)
const openspecialistDetails = function (row){
  specialistDetailsRef.value.open(row)
}

const tableRef = ref(null);
const tableData = ref([
  // {
  //   bookName: 'INFO_1_POSTMAN 白雪book1',
  //   typeName: '13031测试的项目分类',
  //   endDate: 4075977600000,
  //   applyFee: '33.3',
  //   reviewStatus: 'notReview',
  //   reviewScore: '',
  //   expertReviewId: '专家评审测试_1'
  // }
]);
//分页
const count = ref('0')
const handleCurrentChange = (val) => {

}

const handleAction = (row) => {
  console.log('操作行数据:', row);
};
//评审状态
const getReviewStatusText = (status) => {
  switch (status) {
    case 'notReview':
      return '未评审';
    case 'notSubmit':
      return '未提交';
    case 'submit':
      return '已提交';
    case 'refuseReview':
      return '拒评';
    default:
      return status;
  }
};

onMounted(()=>{
  myreview({
    type:'done',
    pageSize:'10',
    pageNum:'1'
  })
      .then((res)=>{
         count.value = res.total
          tableData.value = res.rows
      })
})

</script>

<style scoped lang="scss">
.title-flex{
  display: flex;
  justify-content: space-between;
  text-align: center;

}
</style>